package com.hpq.user.domain.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 *拉入黑名单类型
 */
@Getter
@AllArgsConstructor
public enum BlackTypeEnum {
    IP(1,"IP"),
    UID(2,"UID");
    private final Integer type;
    private final String desc;
    private static Map<Integer,BlackTypeEnum> cache;
    static{
        cache = Arrays.stream(BlackTypeEnum.values()).collect(Collectors.toMap(BlackTypeEnum::getType, Function.identity()));
    }
    public static BlackTypeEnum of(Integer type){
        return cache.get(type);
    }

}
